Functions List


2D Modelling


point

The function point creates a point at a position specified by its coordinates.

Parameters:

p – Point coordinates

Syntax:

(point p)

Example:

> (point (xyz  1 1 5))
#<point 0>



line

The function line draws an open polygonal line defined by a set of given points, specified individually or in the form of a list of coordinates.

Parameters:

p1, p2, p3, …, pn – Line points

Syntax:

(point p1 p2 p3 p4 … pn)
(point (list p1 p2 p3 p4 … pn))

Example:

> (line (xy 0 0) (xy 5 0) (xy 5 5) (xy 0 5) (xy 0 0))
#<line 0>

> (line (list (xy 0 0) (xy 5 0) (xy 5 5) (xy 0 5) (xy 0 0)))
#<line 0>



closed-line and polygon

The functions closed-line and polygon draw a closed polygonal line defined by a set of given points, specified individually or in the form of a list of coordinates.

Parameters:

p1, p2, p3, …, pn – Line points

Syntax:

(polygon p1 p2 p3 p4 … pn)
(polygon (list p1 p2 p3 p4 … pn))

Example:

> (closed-line (xy 0 0) (xy 5 0) (xy 5 5) (xy 0 5))
#<line 0>

> (polygon (pol 1 (* 2 pi 0/5)) (pol 1 (* 2 pi 1/5))
           (pol 1 (* 2 pi 2/5)) (pol 1 (* 2 pi 3/5))
           (pol 1 (* 2 pi 4/5)))
#<(polygon closed-line) 2>



rectangle

The function rectangle draws a rectangle specified by the bottom-left and top-right corners, or by the bottom-left corner, the length and width.

Parameters:

p1 – Bottom-left vertex
p2 – To-right vertex

p – Bottom-left vertex
l – Rectangle length
w – Rectangle width

Syntax:

(rectangle p1 p2)
(rectangle p l w)

Example:

> (rectangle (xy 0 0) (xy 1 1))
#<rectangle 0>

> (rectangle (xy 0 0) 1 1)
#<rectangle 0>



circle

The function circle draws a circle specified by its centre point and radius. If omitted, the centre point will be the UCS origin and the radius will be 1.

Parameters:

c – Circle centre (optional)
r – Circle radius (optional)

Syntax:

(circle c r)

Example:

> (circle (xyz 0 0 0) 5)
#<circle 0>



ellipse

The function ellipse draws an ellipse specified by its centre point, major radius and minor radius. If omitted, the centre point will be the UCS origin and both radii will be 1.

Parameters:

c – Ellipse centre (optional)
a – Major radius (optional)
b – Minor radius (optional)

Syntax:

(ellipse p a b)

Example:

> (ellipse (xyz 0 0 0) 5 2)
#<ellipse 0>



regular-polygon

The function regular-polygon draws a regular polygon defined by the numbers of sides, the centre point, the radius, the initial angle with the X axis and a Boolean value to specify if the polygon is inscribed (#t) or circumscribed (#f). If omitted, the centre point will be the UCS origin, the radius will be 1, the angle 0 and the polygon will be considered circumscribed. If the radius value is 0 the produced result will be a point.

Parameters:

n – Number of edges
c – Polygon centre (optional)
r – Polygon radius (optional)
a – Initial angle (optional)
#t/#f – Inscribed or circumscribed (optional)

Syntax:

(regular-polygon n [c (u0)] [r 1] [a 0] [inscribed? #f])

Example:

> (regular-polygon 5 (xy 0 0) 10 0 #t)
#<(regular-polygon polygon closed-line) 2>



arc

The function arc draws a circular arc specified by its centre point, radius, initial angle and angle amplitude. If omitted, the centre will be the UCS origin the radius will be 1 and the angle domain will be 0 and π.

Parameters:

c – Arc centre (optional)
r – Arc radius (optional)
ai – Initial angle (optional)
af – Angle amplitude (optional)

Syntax:

(arc [c (u0)] [r 1] [ai 0] [af pi])

Example:

> (arc (xyz 0 0 0) 1)
#<arc 0>

> (arc (xyz 0 0 0) 2 pi/4 (- pi pi/4))
#<arc 0>



spline

The function spline draws an open spline interpolating a set of given points. The points can be provided individually or in the form of a list of coordinates.

Parameters:

p1, p2, p3, …, pn – Spline points

Syntax:

(spline p1 p2 p3 p4 … pn)
(spline (list p1 p2 p3 p4 … pn))

Example:

> (spline (xy 0 0) (xy 5 0) (xy 5 5) (xy 0 5) (xy 0 0))
#<spline 0>



closed-spline

The function closed-spline draws a closed spline interpolating a set of given points. The points can be provided individually or in the form of a list of coordinates.

Parameters:

p1, p2, p3, …, pn – Spline points

Syntax:

(closed-spline p1 p2 p3 p4 … pn)
(closed-spline (list p1 p2 p3 p4 … pn))

Example:

> (closed-spline (xy 0 0) (xy 5 0) (xy 5 5) (xy 0 5) (xy 0 0))
#<spline 0>



surface

The function surface creates a surface defined by a closed set of curves, circles or polygon.

Parameters:

shape – Closed shape

Syntax:

(surface shape)

Example:

> (surface (rectangle (xy 0 0) (xy 5 5)))
#<surface 1>

> (surface
   (closed-spline (list (xy 0 0) (xy 5 0) (xy 5 5) (xy 0 5))))
#<surface 1>



surface-rectangle

The function surface-rectangle creates a surface delimited by a rectangle, specified by the bottom-left and top-right corners, or by the bottom-left corner, the length and width.

Parameters:

p1 – Bottom-left vertex
p2 – To-right vertex

p – Bottom-left vertex
l – Rectangle length
w – Rectangle width

Syntax:

(surface-rectangle p1 p2)
(surface-rectangle p l w)

Example:

> (surface-rectangle (xy 0 0) (xy 10 5))
#<surface-rectangle 0>

> (surface-rectangle (xy 0 0) 10 5)
#<surface-rectangle 0>



surface-circle

The function surface-circle creates a surface delimited by a circle, specified by its centre point and radius. If omitted, the centre point will be the UCS origin and the radius will be 1.

Parameters:

c – Circle centre (optional)
r – Circle radius (optional)

Syntax:

(surface-circle c r)

Example:

> (surface-circle (xyz 0 0 0) 5)
#<surface-circle 0>



surface-arc

The function surface-arc creates a surface delimited by a circular arc, specified by its centre point, radius, initial angle and angle amplitude. If omitted, the centre will be the UCS origin the radius will be 1 and the angle domain will be 0 and π.

Parameters:

c – Arc centre (optional)
r – Arc radius (optional)
ai – Initial angle (optional)
af – Angle amplitude (optional)

Syntax:

(surface-arc [c (u0)] [r 1] [ai 0] [af pi])

Example:

> (surface-arc (xy 0 0) 10 pi/4 (* 2 pi/4))
#<surface-arc 0>



surface-polygon

The functions surface-polygon creates a surface delimited by a closed polygonal line, specified by a set of given points, specified individually or in the form of a list of coordinates.

Parameters:

p1, p2, p3, …, pn – Line points

Syntax:

(surface-polygon p1 p2 p3 p4 … pn)
(surface-polygon (list p1 p2 p3 p4 … pn))

Example:

> (surface-polygon (x 0) (x 1) (xy 1 1) (y 1))
#<surface-polygon 0>



surface-regular-polygon

The function surface-regular-polygon creates a surface delimited by a regular polygon, specified by the numbers of sides, the centre point, the radius, the initial angle with the X axis and a Boolean value to specify if the polygon is inscribed (#t) or circumscribed (#f). If omitted, the centre point will be the UCS origin, the radius will be 1, the angle 0 and the polygon will be considered circumscribed. If the radius value is 0 the produced result will be a point.

Parameters:

n – Number of edges
c – Polygon centre (optional)
r – Polygon radius (optional)
a – Initial angle (optional)
#t/#f – Inscribed or circumscribed (optional)

Syntax:

(surface-regular-polygon n [c (u0)] [r 1] [a 0] [inscribed? #f])

Example:

> (surface-regular-polygon 6 (xyz 0 0 0) 1.0 0 #t)
#<(surface-regular-polygon surface) 4>
Top